﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Data.Common;

namespace AAA.Database
{
    public class AccessDatabase : AbstractDatabase
    {
        #region Protected function
        protected override DbConnection CreateConnection()
        {
            return CreateConnection(ConnectionString());
        }

        protected override DbConnection CreateConnection(string strConnectionString)
        {
            return new OleDbConnection(strConnectionString);
        }
        protected override  DbCommand CreateStatement()
        {
            return new OleDbCommand();
        }

        protected override string ConnectionString()
        {
            return String.Format(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Jet OleDb:Database Password={1}",
                                 Database, Password);
        }
        #endregion

        public override int ExecuteScript(string strSQLStatement)
        {
            return 0;
        }

        public override string ToDate(string strDate)
        {
            return "CDATE('" + strDate + "')";
        }

        public override DbParameter CreateParameter()
        {
            return new OleDbParameter();
        }
    }
}
